<template>
  <div>
      <div class="header_cat">
        <div class="header_top">
          <div class="header">
          <div class="header_box" @click="helpClick">
            <span class="icon_help"></span>
            <span>需要帮助？请联系我</span>
          </div>
          <div class="header_box" @click="strategyClick">
            <span class="icon_strategy"></span>
            <span>攻略</span>
          </div>
        </div>
        </div>
        <div class="header_down">
          <home-nav-control class="nav_control"/>
        </div>
        <div class="content">
          <div class="income_details" v-if="incomeShow">
            <div class="user_id">渠道ID:{{userinfo.tgid}}</div>
            <div class="user_yeas">
              <span>昨日收入</span>
              <span class="user_icon" @click="closeClick">
                <span v-show="appType === '277'">
                  <img src="@/assets/img/login/icon_close.png" alt="" v-if="!incomeShow">
                  <img src="@/assets/img/login/icon_open.png" alt="" v-else>
                </span>
                <span v-show="appType === 'cat'">
                  <img src="@/assets/img/login/icon_close_grey.png" alt="" v-if="!incomeShow">
                  <img src="@/assets/img/login/icon_open_grey.png" alt="" v-else>
                </span>
              </span>
            </div>
            <div class="income_money">{{userinfo.yesterday_fee}}</div>
            <div class="user_footer">
              <div>
                <span>总流水</span>
                <span style="color: #FF8110">{{userinfo.total}}</span>
              </div>
              <div>
                <span>提现余额</span>
                <span style="color: #FF8110">{{userinfo.cash_remain}}</span>
              </div>
            </div>
          </div>
          <div class="income_details" v-else>
        <div class="user_id">渠道ID: ******</div>
        <div class="user_yeas">
          <span>昨日收入</span>
          <span class="user_icon" @click="closeClick">
            <span v-show="appType === '277'">
              <img src="@/assets/img/login/icon_close.png" alt="" v-if="!incomeShow">
              <img src="@/assets/img/login/icon_open.png" alt="" v-else>
            </span>
            <span v-show="appType === 'cat'">
              <img src="@/assets/img/login/icon_close_grey.png" alt="" v-if="!incomeShow">
              <img src="@/assets/img/login/icon_open_grey.png" alt="" v-else>
            </span>
          </span>
        </div>
        <div class="income_money">******</div>
        <div class="user_footer">
          <div>
            <span>总流水</span>
            <span style="color: #FF8110">******</span>
          </div>
          <div>
            <span>提现余额</span>
            <span style="color: #FF8110">******</span>
          </div>
        </div>
      </div>
        </div>
      </div>
  </div>
</template>

<script>
import {mapState} from 'vuex'
import { appType } from '../../../assets/js/app'
import HomeNavControl from './HomeNavControl.vue'

export default {
  components: { HomeNavControl },
  props: {
      userinfo: {
        type: Object,
        default() {
          return {}
        }
      }
    },
    data() {
      return {
        appType: null
      }
    },
    created () {
      this.appType = appType();
    },
  methods: {
      closeClick() {
        this.$store.commit('$_incomeShow')
      },
      helpClick() {
        this.$emit('help-click',)
      },
      strategyClick() {
        this.$emit('strategy-click')
      }
    },
    computed: {
      ...mapState([
        'incomeShow'
      ])
    },
}
</script>

<style scoped>
.header_cat {
  width: 750px;
  height: auto;
  position: relative;
  /* border-bottom: 10px solid #EDEDED; */
}

.header_top {
  width: 750px;
height: 302px;
background: linear-gradient(317deg,#ff5641 0%, #ffa939 97%);
}

.header_down {
  width: 750px;
  height: 260px;
  background: #ffffff;
  position: relative;
}

.nav_control {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.content {
  position: absolute;
  top: 110px;
  left: 50%;
  transform: translateX(-50%);
  width: 625px;
height: 318px;
background: #ffffff;
border-radius: 30px;
box-shadow: 0px 0px 20px 0px #9999994d; 
}

.header {
  width: 750px;
  height: 100px;
  box-sizing: border-box;
  padding: 0 35px;
  font-size: 25px;
  font-weight: bold;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.icon_help {
  display: inline-block;
  width: 31px;
  height: 31px;
  background: url('../../../assets/img/home/icon_help.png') no-repeat;
  background-size: 100%;
  margin-right: 12px;
}

.icon_strategy {
  display: inline-block;
  width: 31px;
  height: 31px;
  background: url('../../../assets/img/home/icon_strategy.png') no-repeat;
  background-size: 100%;
  margin-right: 5px;
}

.header_box {
  display: flex;
  align-items: center;
}

.income_details {
  position: relative;
  width: 100%;
  height: 100%;
  /* background: linear-gradient(-25deg, #4B6CF8, #97ABFF); */
  /* border-radius: 30px 30px 0px 0px; */
  color: #333;
  font-size: 24px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.user_id {
  position: absolute;
  right: 0;
  top: 25px;
  height: 44px;
  padding: 0 22px;
  line-height: 44px;
  font-size: 24px;
  text-align: center;
  background: #7974FF;
  color: #fff;
  border-radius: 22px 0px 0px 22px;
}

.user_yeas {
  display: flex;
  align-items: center;
  margin-top: 93px;
}

.income_money {
  font-size: 66px;
  font-weight: bold;
  color: #FF5641;
  line-height: 70px;
  margin-top: 10px;
}

.user_icon {
  width: 22px;
  height: 22px;
  margin-left: 10px;
}

.user_icon img {
  width: 22px;
  height: 22px;
}

.user_footer {
  position: absolute;
  box-sizing: border-box;
  padding: 20px 0;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 100px;
  border-top: 1px solid #FF81103d;
  display: flex;
}

.user_footer div {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
}
</style>